#pragma once
#include <mutex>
struct AVCodecParameters;
struct AVFrame;
struct SwrContext;
class XResample
{
public:
	//输出参数和输入参数一致，除了采样格式,输出为S16,会释放para
	virtual bool Open(AVCodecParameters *para, bool isClearPara = false);
	virtual void Close();

	//返回重采样后的大小,并释放Frame空间
	virtual int Resample(AVFrame *indata, unsigned char *outdata);
	XResample();
	~XResample();
	int outFormat = 1;//S16,具体参考AVFormat枚举类型
protected:
	std::mutex resamplemux;
	SwrContext *actx = 0;
};

